<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0"> 
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
</head>

<body>

</body>
<script>
    var u = navigator.userAgent
    if(u.indexOf('MicroMessenger') != -1){
        //正式
        if(!getUrlParam('code')){
            var alskda = decodeURIComponent(getUrlParam('sign')).split(',')[3] ? decodeURIComponent(getUrlParam('sign')).split(',')[3] : 'wxbb6c59e005d78863';
            var DNS = decodeURIComponent(getUrlParam('sign')).split(',')[4] ? decodeURIComponent(getUrlParam('sign')).split(',')[4] : 'https://szk.lexiangaysh.cn'
            var url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${alskda}&redirect_uri=${DNS}/szkLinkPro/getcode.html&scope=snsapi_base&response_type=code&state=${getUrlParam('sign')}#wechat_redirect`;
            // alert(url)
            window.location.href=url;
        }else{
            var DNS = decodeURIComponent(getUrlParam('state')).split(',')[4] ? decodeURIComponent(getUrlParam('state')).split(',')[4] : 'https://szk.lexiangaysh.cn'
            window.location.href=`${DNS}/szkLinkPro/#/transfer${window.location.search}`;
        }
        //测试
        // if(!getUrlParam('code')){
        //     var alskda = decodeURIComponent(getUrlParam('sign')).split(',')[3] ? decodeURIComponent(getUrlParam('sign')).split(',')[3] : 'wxbb6c59e005d78863';
        //     var DNS = decodeURIComponent(getUrlParam('sign')).split(',')[4] ? decodeURIComponent(getUrlParam('sign')).split(',')[4] : 'https://szk.lexiangaysh.cn'
        //     window.location.href=`https://open.weixin.qq.com/connect/oauth2/authorize?appid=${alskda}&redirect_uri=${DNS}/szkLink/getcode.html&scope=snsapi_base&response_type=code&state=${getUrlParam('sign')}#wechat_redirect`
        // }else{
        //     var DNS = decodeURIComponent(getUrlParam('sign')).split(',')[4] ? decodeURIComponent(getUrlParam('sign')).split(',')[4] : 'https://szk.lexiangaysh.cn'
        //     window.location.href= DNS + "/szkLink/#/transfer"+window.location.search;
        //     // alert(window.location.search)
        // }
    }else{
        var DNS = decodeURIComponent(getUrlParam('sign')).split(',')[4] ? decodeURIComponent(getUrlParam('sign')).split(',')[4] : 'https://szk.lexiangaysh.cn'
        // 正式
        window.location.href=`${DNS}/szkLinkPro/#/transfer${window.location.search}`
        // 测试
        // window.location.href= DNS + "/szkLink/#/transfer"+window.location.search
    }
    

    function getUrlParam(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return unescape(r[2]);
        return null; // 返回参数值
    }
</script>

</html>